package com.bvbot.core.session;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class BasicBvRequest extends BvRequest {

	private final List<KeyValue> keyValues = new ArrayList<BasicBvRequest.KeyValue>();

	public BasicBvRequest(String url) {
		super(url);
	}

	public void addPostParameter(String key, String value) {
		KeyValue kv = new KeyValue(key, value);
		keyValues.add(kv);
	}

	@SuppressWarnings("unused")
	private class KeyValue {
		private String key;
		private String value;

		public KeyValue(String key, String value) {
			super();
			this.key = key;
			this.value = value;
		}

		public String getKey() {
			return key;
		}

		public void setKey(String key) {
			this.key = key;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

	}

	private boolean post = false;

	public boolean isPost() {
		return post;
	}

	public void setPost(boolean post) {
		this.post = post;
	}

	public void addParams(List<NameValuePair> params) {
		for (KeyValue kv : keyValues) {
			params.add(new BasicNameValuePair(kv.getKey(), kv.getValue()));
		}
	}

}
